<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Home extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('file');
        $this->load->helper('fuc');
        $this->load->library('topclass');
        $this->load->database();
        $this->config->load('topapiconfig');
        $this->config->load('sysetting');
        $this->load->model('cats_product');
        $this->load->model('url_topke');
        $this->load->library('taobao_url_process');
    }

    public function index() {
//       $ttt= $this->topclass->api_getShopGetRequest("ShopGetRequest","zwbtj2012");
//       print_r($ttt);
//       
//         exit;
        //    $this->url_topke->change_shoptaoke_url();
        //   exit;

        $url = "http://127.0.0.1/xiaodouwebsite/1/index.php/home/urlform";
        $this->taobao_url_process->get_url_root($url);
        exit;
        print_r(get_urlquery_seg($url));
        $rrr = get_url_itemid(get_urlquery_seg($url));
        print_r($rrr);
        exit;
        $rrr = get_url_host($url);
        //print_r($rrr);
        echo $rrr;
        get_url_root($rrr);
        $this->load->view('welcome_message');
    }

    public function urlform() {
        $cats_array = $this->cats_product->get_cats();
        $data['cats_array'] = $cats_array;
        $submit_type_array = $this->config->item('submit_type');
        print_r($submit_type_array);
        $this->load->view('front/urlform', $data);
    }

    public function url_submit() {
        echo $sql = "insert into prores
(itemname,itemurl,type,istopke,iscoupon,clickcounts,catid,imgurl)values
(\"{$_POST["name"]}\",\"{$_POST["url"]}\",\"{$_POST["type"]}\",0,0,0,
    \"{$_POST["cat"]}\",\"{$_POST["imgurl"]}\")";
        $this->db->query($sql);
        redirect("home/urlform");
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */